<template>
  <div class="navBarContainer" :class="isBottomLine?showBottomBorder:a" :style="{backgroundColor: bgFromData}">
    <img src="../assets/img/x.png" class="leftImg" @click="leftAction"/>
    <span class=" title">{{title}}</span>
    <div class="rightView">
      <slot></slot>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    title: String,
    bgColor: String,
    hiddenLine: String, // yes=>hidden
  },
  name: 'navBar',
  data () {
    return {
      msg: '',
      showBottomBorder: 'showBottomBorder',
      a: '',
      bgFromData: this.bgColor.length > 0 ? this.bgColor : '#fff', //设置默认背景色
    }
  },
  computed: {
    isBottomLine () {
      if (this.hiddenLine && this.hiddenLine === 'yes') {
        return false
      }
      else {
        return true
      }
    },
  },
  methods: {
    leftAction () {
      this.$emit('leftAction')
    },
  },

}
</script>

<style scoped lang="less">

  /*导航条绝对定位, 占据顶部*/
  .navBarContainer {
    width: 3.75rem;
    height: 0.64rem;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: row;
    padding: 0 0.16rem;
    justify-content: space-between;
    align-items: center;
    .leftImg {
      height: 0.14rem;
      width: 0.14rem;
    }
    .title {
      color: #333333;
      font-size: 0.18rem;
      line-height: 0.64rem;
      display: block;
    }
    .rightView {
      background-color: transparent;
      height: 0.64rem;
      width: 0.64rem;
      line-height: 0.64rem;
      text-align: right;
    }
  }

  .showBottomBorder {
    border-bottom: 0.01rem solid rgba(153, 153, 153, 0.3);
    /*border-bottom: 0.01rem solid pink;*/
  }
</style>
